if exists (select 1 from sysobjects where name = 'upd_termin' and type = 'P')
begin
   drop procedure upd_termin
   print 'Procedure: upd_termin deleted ...'
end
go
create procedure upd_termin(
  @terminidin        int           = 1,
  @dienstname        varchar(32)   = 'Sitzung',
  @kurztext          varchar(60)   = 'kurztext',
  @beschreibung      varchar(250)  = 'Sitzung Beschreibung neu',
  @statusin          int           = 1,
  @rgbin             int           = 0,
  @colorname         varchar(32)   = '00000000',
  @shgin             char(1)       = 'S'
)
as
begin
  set nocount on
  declare @beschrid   int
   select @beschrid = beschrid
     from termin
    where terminid = @terminidin
  exec upd_beschreibung @beschrid, @kurztext, @beschreibung
   update termin 
      set name        = @dienstname,
          status      = @statusin,
          defrgb      = @rgbin,
          colorname   = @colorname,
          shg         = upper(@shgin)
    where terminid    = @terminidin

end
go
print 'Procedure: upd_termin done ...'
go
grant exec on upd_termin to prsadmins with grant option
go
grant exec on upd_termin to prsusers
go

